<template>
  <div class="vendor_box" v-loading="signalsRadio1.loading" element-loading-text="加载中...">
    <Totalarticles v-if="signalsRadio1.title.title != ''" />
    <!-- pd20: signalsRadio1.routerPush != 'disposition', -->
    <div :class="{
      pd0: signalsRadio1.routerPush == 'disposition',
    }" style="min-height: 200px" v-if="signalsRadio1.total > 0">
      <div class="vendor" v-for="item in signalsRadio1.corporLiss" :key="item">
        <div>
          <img width="60px" src="../../../../assets/newimg/gys.png" alt="" />
        </div>
        <div style="flex: 1; margin-left: 10px">
          <div class="vendor_cen">
            <div class="vendor_h" v-html="item.title" @click="gysClick(item.title)"></div>
            <div v-if="item.companyOrgType.length > 0">
              <span class="behalf">{{
                item.companyOrgType?.split("\t")[0]
              }}</span>
            </div>
          </div>
          <div class="omission">
            <el-row :gutter="20">
              <el-col :span="3">
                <div class="grays">
                  企业规模 <span class="graysColor">{{ item.staffNum }}人</span>
                </div>
              </el-col>
              <el-col :span="6">
                <div class="grays">
                  注册资本
                  <span class="graysColor">{{ money(item.regCapital) }}人民币</span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grays">
                  法定代表
                  <span class="graysColor">{{ item.representative }}</span>
                </div>
              </el-col>
              <el-col :span="3">
                <div class="grays">
                  经营状态 <span class="graysColor">{{ item.regStatus }}</span>
                </div>
              </el-col>
              <el-col :span="4">
                <div class="grays">
                  公司地址
                  <span class="graysColor">{{ item.regLocation }}</span>
                </div>
              </el-col>
            </el-row>
          </div>
        </div>
      </div>
    </div>
    <Pagination ref="pagination" v-if="bx_center !== 1" />
    <Vips v-if="bx_center == 1" />
    <div v-if="signalsRadio1.corporLiss.length == 0" style="background-color: white; margin: 15px 0">
      <el-empty description="暂无数据" />
    </div>
  </div>
</template>

<script setup>
import Vips from "@/components/vipts/index.vue";
import { ref, onMounted, reactive } from "vue";
import { search_read } from "@/Api/shoop/index.js";
import { money } from "@/utils/index";
import Pagination from "@/components/pagination/index.vue";
import Totalarticles from "../totalarticles/index.vue";
import { useRadio1Store } from "@/pain/search/search";
import { useRouter } from "vue-router";
import { useCounterStore } from "@/pain/login/login";
const signalsRadio1 = useRadio1Store();
import { userInfo } from '@/Api/api.js'
import CryptoJS from "crypto-js";
const key = CryptoJS.enc.Utf8.parse("ysh425ptjhcpo781"); //十六位十六进制数作为密钥偏移量
const iv = CryptoJS.enc.Utf8.parse("53c5a64c6be84e97"); //十六位十六进制数作为密钥偏移量
const token = localStorage.getItem("token");
//解密
function decrypt(text) {
  var result = CryptoJS.AES.decrypt(text, key, {
    iv: iv,
    mode: CryptoJS.mode.CBC,
    padding: CryptoJS.pad.Pkcs7,
  });
  return result.toString(CryptoJS.enc.Utf8);
}
const bx_center = ref(0)
const ids = ref()
if (token) {
  userInfo().then(rex => {
    ids.value = rex.data.data.level_id
    search_read().then((res) => {
      if (res.data.data.gs_center.indexOf(ids.value.toString()) == '-1') {
        bx_center.value = 1
      } else {
        bx_center.value = 0
      }
    });
  })
} else {
  ids.value = 0
}


const gspk = () => {
  if (signalsRadio1.routerPush == "disposition") {
    signalsRadio1.getcompetitors();
  }
};
gspk();
const useRouters = useCounterStore();
const router = useRouter();
const gysClick = (data) => {
  if (!localStorage.getItem("token")) {
    return (useRouters.uselogin = true);
  }
  const href = router.resolve({
    path: "/disposition",
    query: {
      id: signalsRadio1.id,
      name: data.replace(/<[^>]+>/g, ""),
    },
  });
  window.open(href.href, "_blank");
};
// const pagination = ref(null);
// pagination.value.currentPage
// pagination.value.pageSize
</script>

<style lang="scss" scoped>
.pd0 {
  padding: 0;
}

.pd20 {
  padding: 0 20px;
  min-height: 500px;
}

.grays {
  width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #a9b1be;
}

.graysColor {
  color: #484949;
}

.behalf {
  height: 20px;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: #fe8d03;
  color: #fff;
  margin-right: 20px;
  font-size: 12px;
}

.behalf_size {
  padding: 0 5px;
  font-size: 18px;
  font-weight: 800;
}

.vendor_box {
  background-color: #fff;

  //
  .forecast {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    border-bottom: 1px solid #eeeeee;
    // .forecast_ck{
    //     height: 30px;
    //     padding: 3px 10px;
    //     background-color: #5473DA;
    //     border-radius: 4px;
    //     color: #fff;
    // }
  }

  .vendor {
    display: flex;
    padding: 20px;
    border-bottom: 1px solid #eeeeee;
    cursor: pointer;

    &:hover {
      background-color: #eeeeee;
    }
  }

  .vendor_cen {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;

    .vendor_h {
      margin-top: 5px;
      font-size: 16px;
      color: #333333;
    }
  }

  .omission {
    width: 1090px;
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 14px;
  }
}
</style>
